﻿@using System.Linq
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>交易管理系统</title>
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="~/assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/assets/font-awesome/4.5.0/css/font-awesome.min.css" />

    <!-- page specific plugin styles -->
    <!-- text fonts -->
    <link rel="stylesheet" href="~/assets/css/fonts.googleapis.com.css" />
    <link href="~/assets/css/select2.min.css" rel="stylesheet" />
    <link href="~/assets/css/chosen.min.css" rel="stylesheet">
    <!-- ace styles -->
    <link rel="stylesheet" href="~/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />

    <!--[if lte IE 9]>
        <link rel="stylesheet" href="assets/css/ace-part2.min.css" class="ace-main-stylesheet" />
    <![endif]-->
    <link rel="stylesheet" href="~/assets/css/ace-skins.min.css" />
    <link href="~/assets/css/jquery-ui.custom.min.css" rel="stylesheet" />
    <link href="~/assets/css/jquery-ui.min.css" rel="stylesheet" />
    <link href="~/assets/css/ace-rtl.min.css" rel="stylesheet" />
    <link href="~/lib/jstree/dist/themes/default/style.css" rel="stylesheet" />

    <!--[if lte IE 9]>
      <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
    <![endif]-->
    <!-- inline styles related to this page -->
    <!-- ace settings handler -->
    <!-- /.main-container -->
    <!-- basic scripts -->
    <!--[if !IE]> -->
    <script src="~/assets/js/jquery-2.1.4.min.js"></script>

    <script src="~/assets/js/bootstrap.min.js"></script>
    <!-- <![endif]-->
    <!--[if IE]>
    <script src="assets/js/jquery-1.11.3.min.js"></script>
    <![endif]-->
    <script type="text/javascript">
        if ('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
    </script>
    <script src="~/assets/js/ace-extra.min.js"></script>
    <script src="~/assets/js/spin.js"></script>
    @*<script src="~/assets/js/select2.min.js"></script>*@
    <script src="~/lib/select2/dist/js/select2.full.js"></script>
    <script src="~/lib/select2/dist/js/i18n/zh-CN.js"></script>
    <script src="~/assets/js/chosen.jquery.min.js"></script>
    <script src="~/lib/layer/src/layer.js"></script>
    <script src="~/js/enum.js"></script>
    <script src="~/lib/linq4js/dist/linq4js.js"></script>
    <script src="~/assets/js/jquery.validate.min.js"></script>
    <!-- page specific plugin scripts -->
    <!-- ace scripts -->
    <script src="~/assets/js/ace-elements.min.js"></script>
    <script src="~/assets/js/ace.min.js"></script>
    <script src="~/assets/js/jquery-ui.min.js"></script>
    <script src="~/lib/echarts/echarts.min.js"></script>
    <script src="~/lib/echarts/echarts-gl.min.js"></script>
    <script src="~/js/jquery-lagerPager.js"></script>
    <script src="~/lib/jstree/dist/jstree.js"></script>
    <!-- inline scripts related to this page -->
    <script type="text/javascript">
        
        Array.prototype.indexOf = function (val) {
            for (var i = 0; i < this.length; i++) {
                if (this[i] == val) return i;
            }
            return -1;
        };

        Array.prototype.remove = function (val) {
            var index = this.indexOf(val);
            if (index > -1) {
                this.splice(index, 1);
            }
        };



        (function ($) {
            $.widget("ui.dialog", $.ui.dialog, {
                open: function () {

                    return this._super();
                },
                _allowInteraction: function (event) {
                    return !!$(event.target).is(".select2-search__field") || this._super(event);
                }
            });
        })(jQuery);


        (function ($) {
            $.chromatable = {
                defaults: {
                    width: "100%",
                    height: "300px",
                    scrolling: "yes"
                }
            };
            $.fn.chromatable = function (options) {
                var options = $.extend({}, $.chromatable.defaults, options);
                return this.each(function () {
                    var $this = $(this);
                    var parent = $(this).parent().parent();
                    if (parent.hasClass("scrolling_outer")) {

                        $(this).insertAfter($(parent));
                        $(parent).remove();
                    }
                    var $uniqueID = $(this).attr("ID") + ("wrapper");
                    $(this).css('width', options.width).addClass("_scrolling");
                    $(this).wrap('<div class="scrolling_outer"><div id="' + $uniqueID + '" class="scrolling_inner"></div></div>');
                    $(".scrolling_outer").css({ 'position': 'relative' });
                    $("#" + $uniqueID).css(
                        {
                            'border': '1px solid #CCCCCC',
                            'overflow-x': 'hidden',
                            'overflow-y': 'auto',
                            'padding-right': '17px'
                        });

                    $("#" + $uniqueID).css('height', options.height);
                    $("#" + $uniqueID).css('width', options.width);
                    $(this).before($(this).clone().attr("id", "").addClass("_thead").css(
                        {
                            'width': 'auto',
                            'display': 'block',
                            'position': 'absolute',
                            'border': 'none',
                            'border-bottom': '1px solid #CCC',
                            'top': '1px'
                        }));
                    $('._thead').children('tbody').remove();
                    $(this).each(function ($this) {
                        if (options.width == "100%" || options.width == "auto") {
                            $("#" + $uniqueID).css({ 'padding-right': '0px' });
                        }
                        if (options.scrolling == "no") {
                            $("#" + $uniqueID).before('<a href="#" class="expander" style="width:100%;">Expand table</a>');
                            $("#" + $uniqueID).css({ 'padding-right': '0px' });
                            $(".expander").each(
                                function (int) {
                                    $(this).attr("ID", int);
                                    $(this).bind("click", function () {
                                        $("#" + $uniqueID).css({ 'height': 'auto' });
                                        $("#" + $uniqueID + " ._thead").remove();
                                        $(this).remove();
                                    });
                                });
                            $("#" + $uniqueID).resizable({ handles: 's' }).css("overflow-y", "hidden");
                        }
                    });
                    $curr = $this.prev();
                    $("thead:eq(0)>tr th", this).each(function (i) {
                        $("thead:eq(0)>tr th:eq(" + i + ")", $curr).width($(this).width());
                    });
                    if (options.width == "100%" || "auto") {
                        $(window).resize(function () {
                            resizer($this);
                        });
                    }
                });
            };
            function resizer($this) {
                $curr = $this.prev();
                $("thead:eq(0)>tr th", $this).each(function (i) {
                    $("thead:eq(0)>tr th:eq(" + i + ")", $curr).width($(this).width());
                });
            };
        })(jQuery);



        function showSpin() {
            var spinnerOpts = {
                lines: 11 // 共有几条线组成
                , length: 13 // 每条线的长度
                , width: 8 // 每条线的长度
                , radius: 19 // 内圈的大小
                , scale: 0.5 // Scales overall size of the spinner
                , corners: 0.1 // 圆角的程度
                , color: '#000' // #rgb or #rrggbb or array of colors
                , opacity: 0.1 // Opacity of the lines
                , rotate: 18 // 整体的角度（因为是个环形的，所以角度变不变其实都差不多）
                , direction: 1 // 1: clockwise, -1: counterclockwise
                , speed: 0.8 // 速度：每秒的圈数
                , trail: 55 //  高亮尾巴的长度
                , fps: 20 // Frames per second when using setTimeout() as a fallback for CSS
                , zIndex: 2e9 // z-index的值 2e9（默认为2000000000
                , className: 'spinner' // The CSS class to assign to the spinner
                , top: '50%' // Top position relative to parent
                , left: '50%' // Left position relative to parent
                , shadow: false // 是否要阴影
                , hwaccel: false // 是否用硬件加速
                , position: 'absolute' // Element positioning
            };
            var spinTarget = document.getElementById('main');
            new Spinner(spinnerOpts).spin(spinTarget);
        }
        Date.prototype.format = function (fmt) {
            var o = {
                "M+": this.getMonth() + 1,                 //月份
                "d+": this.getDate(),                    //日
                "h+": this.getHours(),                   //小时
                "m+": this.getMinutes(),                 //分
                "s+": this.getSeconds(),                 //秒
                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                "S": this.getMilliseconds()             //毫秒
            };
            if (/(y+)/.test(fmt)) {
                fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            }
            for (var k in o) {
                if (new RegExp("(" + k + ")").test(fmt)) {
                    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                }
            }
            return fmt;
        }


        function AjaxData(url, data, type, selector, successFun) {
            $.ajax({
                url: url,
                data: data,
                type: type,
                beforeSend: function () {
                    if (undefined != selector && null != selector) {
                        $(selector).addClass("disabled");
                    }
                    showSpin();
                    ////异步请求时spinner出现
                    //var target = $($("#mb"));
                    //spinner.spin(target);
                },
                success: successFun,
                complete: function () {
                    $(".spinner").hide();
                    if (undefined != selector && null != selector) {
                        $(selector).removeClass("disabled");
                    }
                }
            });
        }

    </script>
    <style>
        .pager-msg {
            height: 26px;
            line-height: 1.8;
            background-color: white;
            color: black
        }

        .selected td {
            background-color: #d0e9c6;
        }
    </style>
</head>

<body class="no-skin">
    <div id="navbar" class="navbar navbar-default ace-save-state">
        <div class="navbar-container ace-save-state" id="navbar-container">
            <button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
                <span class="sr-only">Toggle sidebar</span>

                <span class="icon-bar"></span>

                <span class="icon-bar"></span>

                <span class="icon-bar"></span>
            </button>

            <div class="navbar-header pull-left">
                <a href="~/Home/Index" class="navbar-brand">
                    <small>
                        <i class="fa fa-leaf"></i>
                        交易管理系统
                    </small>
                </a>
            </div>

            <div class="navbar-buttons navbar-header pull-right" role="navigation">

                <ul class="nav ace-nav">

                    @*<li class="purple dropdown-modal">
                            <a class="dropdown-toggle" href="#" data-toggle="dropdown">
                                <i class="ace-icon fa fa-bell icon-animated-bell"></i>
                                <span class="badge badge-important">8</span>
                            </a>
                            <ul class="dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-close dropdown-menu-right">
                                <li class="dropdown-header">
                                    <i class="ace-icon fa fa-exclamation-triangle"></i>
                                    8 Notifications
                                </li>
                                <li class="dropdown-content ace-scroll" style="position: relative;">
                                    <div class="scroll-track" style="display: none;"><div class="scroll-bar"></div></div><div class="scroll-content" style="max-height: 200px;">
                                        <ul class="dropdown-menu dropdown-navbar navbar-pink">
                                            <li>
                                                <a href="#">
                                                    <div class="clearfix">
                                                        <span class="pull-left">
                                                            <i class="btn btn-xs no-hover btn-pink fa fa-comment"></i>
                                                            New Comments
                                                        </span>
                                                        <span class="badge badge-info pull-right">+12</span>
                                                    </div>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="#">
                                                    <i class="btn btn-xs btn-primary fa fa-user"></i>
                                                    Bob just signed up as an editor ...
                                                </a>
                                            </li>
                                            <li>
                                                <a href="#">
                                                    <div class="clearfix">
                                                        <span class="pull-left">
                                                            <i class="btn btn-xs no-hover btn-success fa fa-shopping-cart"></i>
                                                            New Orders
                                                        </span>
                                                        <span class="badge badge-success pull-right">+8</span>
                                                    </div>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="#">
                                                    <div class="clearfix">
                                                        <span class="pull-left">
                                                            <i class="btn btn-xs no-hover btn-info fa fa-twitter"></i>
                                                            Followers
                                                        </span>
                                                        <span class="badge badge-info pull-right">+11</span>
                                                    </div>
                                                </a>
                                            </li>
                                        </ul>
                                    </div>
                                </li>
                                <li class="dropdown-footer">
                                    <a href="#">
                                        See all notifications
                                        <i class="ace-icon fa fa-arrow-right"></i>
                                    </a>
                                </li>
                            </ul>
                        </li>*@
                    <li class="green dropdown-modal">
                        <a class="dropdown-toggle" href="#" data-toggle="dropdown">
                            <i class="ace-icon fa fa-envelope icon-animated-vertical"></i>
                            <span class="badge badge-success">5</span>
                        </a>
                        <ul class="dropdown-navbar dropdown-menu dropdown-caret dropdown-close dropdown-menu-right">
                            <li class="dropdown-header">
                                <i class="ace-icon fa fa-envelope-o"></i>
                                5 Messages
                            </li>
                            <li class="dropdown-content ace-scroll" style="position: relative;">
                                <div class="scroll-track" style="display: none;"><div class="scroll-bar"></div></div><div class="scroll-content" style="max-height: 200px;">
                                    <ul class="dropdown-menu dropdown-navbar">
                                        <li>
                                            <a class="clearfix" href="#">
                                                <img class="msg-photo" alt="Alex's Avatar" src="~/assets/images/avatars/avatar.png">
                                                <span class="msg-body">
                                                    <span class="msg-title">
                                                        <span class="blue">Alex:</span>
                                                        Ciao sociis natoque penatibus et auctor ...
                                                    </span>
                                                    <span class="msg-time">
                                                        <i class="ace-icon fa fa-clock-o"></i>
                                                        <span>a moment ago</span>
                                                    </span>
                                                </span>
                                            </a>
                                        </li>
                                        <li>
                                            <a class="clearfix" href="#">
                                                <img class="msg-photo" alt="Susan's Avatar" src="~/assets/images/avatars/avatar3.png">
                                                <span class="msg-body">
                                                    <span class="msg-title">
                                                        <span class="blue">Susan:</span>
                                                        Vestibulum id ligula porta felis euismod ...
                                                    </span>
                                                    <span class="msg-time">
                                                        <i class="ace-icon fa fa-clock-o"></i>
                                                        <span>20 minutes ago</span>
                                                    </span>
                                                </span>
                                            </a>
                                        </li>
                                        <li>
                                            <a class="clearfix" href="#">
                                                <img class="msg-photo" alt="Bob's Avatar" src="~/assets/images/avatars/avatar4.png">
                                                <span class="msg-body">
                                                    <span class="msg-title">
                                                        <span class="blue">Bob:</span>
                                                        Nullam quis risus eget urna mollis ornare ...
                                                    </span>
                                                    <span class="msg-time">
                                                        <i class="ace-icon fa fa-clock-o"></i>
                                                        <span>3:15 pm</span>
                                                    </span>
                                                </span>
                                            </a>
                                        </li>
                                        <li>
                                            <a class="clearfix" href="#">
                                                <img class="msg-photo" alt="Kate's Avatar" src="~/assets/images/avatars/avatar2.png">
                                                <span class="msg-body">
                                                    <span class="msg-title">
                                                        <span class="blue">Kate:</span>
                                                        Ciao sociis natoque eget urna mollis ornare ...
                                                    </span>
                                                    <span class="msg-time">
                                                        <i class="ace-icon fa fa-clock-o"></i>
                                                        <span>1:33 pm</span>
                                                    </span>
                                                </span>
                                            </a>
                                        </li>
                                        <li>
                                            <a class="clearfix" href="#">
                                                <img class="msg-photo" alt="Fred's Avatar" src="~/assets/images/avatars/avatar5.png">
                                                <span class="msg-body">
                                                    <span class="msg-title">
                                                        <span class="blue">Fred:</span>
                                                        Vestibulum id penatibus et auctor  ...
                                                    </span>
                                                    <span class="msg-time">
                                                        <i class="ace-icon fa fa-clock-o"></i>
                                                        <span>10:09 am</span>
                                                    </span>
                                                </span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </li>
                            <li class="dropdown-footer">
                                <a href="inbox.html">
                                    See all messages
                                    <i class="ace-icon fa fa-arrow-right"></i>
                                </a>
                            </li>
                        </ul>
                    </li>
                    <li class="light-blue dropdown-modal">
                        <a class="dropdown-toggle" aria-expanded="false" href="#" data-toggle="dropdown">
                            <img class="nav-user-photo" alt="Jason's Photo" src="~/assets/images/avatars/user.jpg">
                            <span class="user-info">
                                <small>欢迎,</small>
                                <span class="text-center userName"></span>
                            </span>
                            <i class="ace-icon fa fa-caret-down"></i>
                        </a>
                        <ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
                            <li>


                                <a class="" role="button" href="#updatePwdModal" data-toggle="modal">
                                    <i class="ace-icon fa fa-cog"></i>
                                    修改密码
                                </a>
                            </li>

                            <li>
                                <a href="profile.html">
                                    <i class="ace-icon fa fa-user"></i>
                                    个人信息
                                </a>
                            </li>

                            <li class="divider"></li>

                            <li>

                                <a href="~/Login/SignOut" id="singOut">
                                    <i class="ace-icon fa fa-power-off"></i>
                                    登出
                                </a>

                                @*<button id="btnLogin" type="submit" class="ace-icon fa fa-power-off">登出</button>*@

                            </li>
                        </ul>
                    </li>
                </ul>


            </div>
        </div><!-- /.navbar-container -->
    </div>

    <div class="main-container ace-save-state" id="main-container">
        <script type="text/javascript">
            try { ace.settings.loadState('main-container') } catch (e) { }
        </script>

        <div id="sidebar" class="sidebar responsive ace-save-state  menu-min">
            <script type="text/javascript">
                try { ace.settings.loadState('sidebar') } catch (e) { }
            </script>

            <ul class="nav nav-list" id="baseMenus">
                <li class="">
                    <a href="#" class="dropdown-toggle">
                        <i class="menu-icon fa fa-tachometer"></i>
                        <span class="menu-text"> 系统管理 </span>
                        <b class="arrow fa fa-angle-down"></b>
                    </a>
                    <b class="arrow"></b>

                    <ul class="submenu" style="display:block;"></ul>
                </li>
                <li class="">
                    <a href="#" class="dropdown-toggle">
                        <i class="menu-icon fa fa-tachometer"></i>
                        <span class="menu-text">
                            基础设置
                        </span>

                        <b class="arrow fa fa-angle-down"></b>
                    </a>

                    <b class="arrow"></b>
                    <ul class="submenu" style="display:block;">
                        

                    </ul>

                </li>
                <li class="">
                    <a href="#" class="dropdown-toggle">
                        <i class="menu-icon fa fa-desktop"></i>
                        <span class="menu-text">
                            投注管理
                        </span>

                        <b class="arrow fa fa-angle-down"></b>
                    </a>

                    <b class="arrow"></b>
                    <ul class="submenu" style="display:block;">
                        @*<li class="">
                    <a href="#">
                        <i class="menu-icon fa fa-caret-right"></i>
                        分析比赛
                    </a>

                    <b class="arrow"></b>
                </li>
                <li class="">
                    <a href="#">
                        <i class="menu-icon fa fa-caret-right"></i>
                        投注
                    </a>

                    <b class="arrow"></b>
                </li>
                <li class="">
                    <a href="#">
                        <i class="menu-icon fa fa-caret-right"></i>
                        投注单
                    </a>

                    <b class="arrow"></b>
                </li>
                <li class="">
                    <a href="#">
                        <i class="menu-icon fa fa-caret-right"></i>
                        审核
                    </a>

                    <b class="arrow"></b>
                </li>

                <li class="">
                    <a href="#">
                        <i class="menu-icon fa fa-caret-right"></i>
                        投注用户
                    </a>

                    <b class="arrow"></b>
                </li>

                <li class="">
                    <a href="#">
                        <i class="menu-icon fa fa-caret-right"></i>
                        站点
                    </a>

                    <b class="arrow"></b>
                </li>*@

                    </ul>

                </li>



            </ul><!-- /.nav-list -->

            <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
                <i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-right ace-save-state" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
            </div>
        </div>

        <div class="main-content">
            <div class="main-content-inner" id="main">

                <div class="page-content">


                    @RenderBody()

                </div>
            </div>


        </div>
        @*<div class="footer">
                <div class="footer-inner">
                    <div class="footer-content">
                        <span class="bigger-120">
                            <span class="blue bolder">微创科技</span>
                            足彩分析 &copy; 2015-2017
                        </span>

                        &nbsp; &nbsp;

                    </div>
                </div>
            </div>*@

        <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
            <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
        </a>
        <div id="updatePwdModal" class="modal fade" tabindex="-1">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h3 class="smaller lighter blue no-margin">修改密码</h3>
                    </div>

                    <div class="modal-body">

                        <div class="row">
                            <div class="col-xs-12">
                                <form class="form-horizontal" role="form">
                                    <input type="hidden" id="Id" />
                                    <input type="hidden" id="ParentId" />
                                    @*<div class="form-group">
                                            <label class="col-sm-3 control-label no-padding-right" for="oldPwd">旧密码 </label>
                                            <div class="col-sm-10">
                                                <input class="form-control" id="oldPwd" type="password" placeholder="旧密码">
                                            </div>
                                        </div>*@
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label no-padding-right" for="oldPwd">旧密码</label>
                                        <div class="col-sm-9">
                                            <input class="col-xs-10 col-sm-10" id="oldPwd" type="password" placeholder="旧密码">
                                        </div>
                                    </div>


                                    <div class="space-4"></div>


                                    <div class="form-group">
                                        <label class="col-sm-3 control-label no-padding-right" for="newPwd">新密码</label>
                                        <div class="col-sm-9">
                                            <input class="col-xs-10 col-sm-10" id="newPwd" type="password" placeholder="新密码">
                                        </div>
                                    </div>

                                    <div class="space-4"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label no-padding-right" for="newPwdQ">确认</label>
                                        <div class="col-sm-9">
                                            <input class="col-xs-10 col-sm-10" id="newPwdQ" type="password" placeholder="确认">
                                        </div>
                                    </div>
                                </form>


                            </div>
                        </div>
                    </div>

                    <div class="modal-footer">

                        <button id="btnUpdatePwd" class="btn btn-white btn-inverse btn-sm" type="button">保存</button>
                        <button class="btn btn-white btn-inverse btn-sm" data-dismiss="modal">

                            取消
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div>

    </div>

    @* 遮罩div *@
    <div id="loadingDiv" style="z-index: 1000;display:none;width:100%;height:100%;background:rgba(0,0,0,.25);position:absolute;top:1px;left:1px;">
        <div id="load_main"></div>
    </div>

    <div>
        <audio id="msgAudio"><source src="~/audio/msg.mp3" type="audio/mpeg"></audio>
    </div>

</body>

</html>
<script type="text/javascript">
    Array.prototype.contains = function (needle) {
        for (i in this) {
            if (this[i] == needle) return true;
        }
        return false;
    }

    var currenrUser;
    $(function () {

        GetNewMatchNumbers();
        var url = location.href;
        var urlArr = url.split('/');

        var action = urlArr[urlArr.length - 2] + '/' + urlArr[urlArr.length - 1];
        $.each($(".submenu a"), function (i, n) {
            if ($(n).attr("href").indexOf(action) > 0) {
                $(n).parent().addClass("active");
            }

        });


        $("#btnUpdatePwd").click(function () {
            var oldPwd = $("#oldPwd").val();
            var newPwd = $("#newPwd").val();
            var newPwdQ = $("#newPwdQ").val();
            if (oldPwd.length == 0 || newPwd.length == 0 || newPwdQ.length == 0) {
                layer.tips("输入框不能为空", "#btnUpdatePwd");

                return;
            }

            if (newPwd != newPwdQ) {
                layer.tips("2次输入的新密码不一致", "#btnUpdatePwd");
                return;
            }


            var postData = { oldPassword: oldPwd, newPassword: newPwd };
            $.ajax({
                type: "Post",
                url: "/AppUser/UpdatePassword",
                data: postData,
                success: function (data) {
                    if (data.result == "Success") {
                        layer.alert("更新密码成功");

                        $("#updatePwdModal").modal("hide");
                        $("#btnLogin").trigger("click");
                    } else {
                        layer.tips(data.message, "#btnUpdatePwd");
                    };
                }
            });
        })
        //var m = $("#RenderBody");
        //m.css("max-height", ($(window).height() - $("header").height() - $("footer").height()-30));  
        GetCurrentUser();
        GetCurrentUserMenus();
    });

    function GetNewMatchNumbers() {
        AjaxData("/JCMatch/GetNewMatchNumbers", "", "Get", "", function (d) {

            if (undefined != d && d.success) { 

                if (d.data != null && d.data.length > 0) {
                    layer.alert("有新的比赛发布,ID为["+d.data.join(",")+"]");
                    $("#msgAudio")[0].play();
                }

            }
        });

        setTimeout("GetNewMatchNumbers()", 50000); 

    }

    function GetCurrentUser() {
        $.get("/Login/GetCurrentUser", "").done(function (d) {
            if (undefined != d) {
                if (d.success) {
                    if (null == d.data) {
                        location.href = "/Login/Index";

                    } else { 

                        currenrUser = d.data;
                        $('.userName').html(d.data.name);
                    }

                }

            }

           
        });
    }

    function GetCurrentUserMenus() {

        AjaxData("/Login/GetCurrentUserMenus", "", "Get", "", function (d) {
            $("ul.submenu:eq(0)").empty();
            $("ul.submenu:eq(1)").empty();
            if (undefined != d && d.success) {
                var s = '';
                var ss = '';
                var sss = '';

                var parentS = d.data.Where(function (x) { return x.parentId == 0; });

                $.each(parentS, function (i, n) {
                    s += '<li class=""><a href= "#" class="dropdown-toggle" > <i class="' + n.icon + '"></i><span class="menu-text"> ' + n.name + ' </span><b class="arrow fa fa-angle-down"></b> </a ><b class="arrow"></b> <ul class="submenu" style="display:block;">';

                    var child = d.data.Where(function (x) { return x.parentId == n.id });
                    $.each(child, function (j, k) {
                        s += '<li class=""><a href= "' + (k.url != null ? k.url : "#") + '" ><i class="menu-icon fa fa-caret-right"></i>' + k.name + '</a > <b class="arrow"></b></li >';

                     });
                    s += '</ul></li >';
                });


                $("#baseMenus").empty().html(s);

                //$.each(d.data, function (i, n) {
                //    if (n.remarks == "1") {

                //        s += '<li class=""><a href= "' + (n.url != null ? n.url : "#") + '" ><i class="menu-icon fa fa-caret-right"></i>' + n.name + '</a > <b class="arrow"></b></li >';
                //    } else if (n.remarks == "2") {
                //        ss += '<li class=""><a href= "' + (n.url != null ? n.url : "#") + '" ><i class="menu-icon fa fa-caret-right"></i>' + n.name + '</a > <b class="arrow"></b></li >';

                //    } else { 

                //        sss += '<li class=""><a href= "' + (n.url != null ? n.url : "#") + '" ><i class="menu-icon fa fa-caret-right"></i>' + n.name + '</a > <b class="arrow"></b></li >';
                //    }

                //});
                //$("ul.submenu:eq(0)").html(s);
                //$("ul.submenu:eq(1)").html(ss);
                //$("ul.submenu:eq(2)").html(sss);

            }

        });
    }

</script>


